package com.loopy.fruns.dao.impl;

import com.loopy.fruns.dao.BasicDAO;
import com.loopy.fruns.dao.FurnDAO;
import com.loopy.fruns.dao.OrderDAO;
import com.loopy.fruns.entity.Furn;
import com.loopy.fruns.entity.Order;

public class OrderDAOImpl extends BasicDAO<Order>  implements OrderDAO {
    private FurnDAO furnDAO=new FurnDAOImpl();
    @Override
    public int saveOrder(Order order) {
        String sql="insert into `order`(`id`,`create_time`,`price`,`status`,`member_id`) VALUES(?,?,?,?,?)";
        return update(sql, order.getId(),order.getCreateTime(), order.getPrice(), order.getStatus(), order.getMemberId());
    }

    @Override
    public Order queryOrderById(String orderId) {
        String sql="\n" +
                "select `id`,`create_time` as createTime,`price`,`status`,`member_id` as memberId from `order` where `id`=?";
        Order order = QuerySingle(sql, Order.class, orderId);
        return order;
    }
}
